package com.atguigu.java.langchain4j.controller;

import com.atguigu.java.langchain4j.Bean.ChatForm;
import com.atguigu.java.langchain4j.assitant.XiaozhiAgent;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 沈复龙
 * @date 2025/6/6
 * @description
 */
@Tag(name ="硅谷小智")
@RestController
@RequestMapping("/xiaozhi")
public class XiaozhiController {

    @Autowired
    private XiaozhiAgent xiaozhiAgent;
    @Operation(summary = "对话")


    @PostMapping("/chat")
    public String chat(@RequestBody ChatForm form) {
        return xiaozhiAgent.chat(form.getMemoryId(), form.getMessage());
    }
}
